Used fixed point instead of approximate fp to reduce rounding error on
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 2 Dec 2003 17:54:14 +0000 (17:54 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 2 Dec 2003 17:54:14 +0000 (17:54 +0000)
Garmin waypt xfer.

gpsbabel/jeeps/gpsmath.c

index bddf5f1dab13b1ddd9659d267624dd875643bc86..9e0bdf802c802bfde1b082db9e98fc94d293c8d7 100644 (file)
@@ -250,7 +250,7 @@ double GPS_Math_Feet_To_Metres(double v)
 
 int32 GPS_Math_Deg_To_Semi(double v)
 {
-    return (int32) (((double)2.147483e9/(double)180)*(double)v);
+    return ((1U<<31) / 180) * v;
 }
 
 
@@ -266,7 +266,7 @@ int32 GPS_Math_Deg_To_Semi(double v)
 
 double GPS_Math_Semi_To_Deg(int32 v)
 {
-    return (double) (((double)v/(double)2.147483e9) * (double)180);
+    return v / (double) ((1U<<31) * 180);
 }